﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Southridge.View 
{
	/// <summary>
	/// Interaction logic for ListingDetails.xaml
	/// </summary>
	public partial class ListingDetails: UserControl,  IViewManagerChild 
	{
		public ListingDetails()
		{
			this.InitializeComponent();
		}

        // I could have used an attached behavior here..  
        // I am sure lots will argue that..  
        // but I consider this a pure behavior/constrain of the view..  
        // we are just changing the behavior of the listbox to change selection based on Mouse Enter
        // The View model should not care how selection is happening ( via keyboard, mouse or what ever) 
        // so I left it here mostly as an example, to "stretch it into making a point" ..
        private void ImagesListBox_MouseEnter(object sender, MouseEventArgs e)
        {
            ImagesListBox.SelectedItem = (sender as Grid).DataContext;
            if (!ImagesListBox.IsFocused)
                ImagesListBox.Focus(); 
        }


         public void Activated(Views newView)
        {
            if (newView != Views.Details)
                this.Visibility = Visibility.Hidden; 

            
        }
	}
}